package com.blogsoho.taurus.controller;

import com.blogsoho.taurus.constants.URIMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.blogsoho.taurus.services.CategoryService;

/**
 * Created by user on 2017/6/5.
 */
@EnableAutoConfiguration
@Controller
@RequestMapping(URIMapping.BLOG)
public class IndexController extends BaseController {

	@Autowired
	private CategoryService categoryService;

	@GetMapping("")
	public String index(ModelMap model) throws Exception {
		model.addAttribute("category", categoryService.getAllCategory());
		return "index";
	}

	@GetMapping("contact")
	public String contact(ModelMap model) {
		return "contact-us";
	}
}
